package com.student.model;

import java.sql.Timestamp;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Teacher entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "Teacher", schema = "dbo", catalog = "StudentManager")
public class Teacher implements java.io.Serializable {

	// Fields

	private Long teacherId;
	private College college;
	private TeacherTitleType teacherTitleType;
	private TeacherPositionType teacherPositionType;
	private String teacherNickName;
	private String teacherName;
	private String password;
	private String phone;
	private String mobile;
	private String qq;
	private String email;
	private Boolean sex;
	
	@Column(name="Sex")
	public Boolean getSex() {
		return sex;
	}

	public void setSex(Boolean sex) {
		this.sex = sex;
	}

	private Timestamp lastLoginTime;
	private String teacherNumber;
	private Set<ClassInfo> classInfos = new HashSet<ClassInfo>(0);
	private Set<TeacherAppraisal> teacherAppraisals = new HashSet<TeacherAppraisal>(
			0);

	// Constructors

	/** default constructor */
	public Teacher() {
	}

	/** minimal constructor */
	public Teacher(Long teacherId, String teacherName, String password) {
		this.teacherId = teacherId;
		this.teacherName = teacherName;
		this.password = password;
	}

	/** full constructor */
	public Teacher(Long teacherId, College college,
			TeacherTitleType teacherTitleType,
			TeacherPositionType teacherPositionType, String teacherNickName,
			String teacherName, String password, String phone, String mobile,
			String qq, String email, Timestamp lastLoginTime,
			String teacherNumber, Set<ClassInfo> classInfos,
			Set<TeacherAppraisal> teacherAppraisals) {
		this.teacherId = teacherId;
		this.college = college;
		this.teacherTitleType = teacherTitleType;
		this.teacherPositionType = teacherPositionType;
		this.teacherNickName = teacherNickName;
		this.teacherName = teacherName;
		this.password = password;
		this.phone = phone;
		this.mobile = mobile;
		this.qq = qq;
		this.email = email;
		this.lastLoginTime = lastLoginTime;
		this.teacherNumber = teacherNumber;
		this.classInfos = classInfos;
		this.teacherAppraisals = teacherAppraisals;
	}

	// Property accessors
	@Id
	@Column(name = "Teacher_id", unique = true, nullable = false, precision = 18, scale = 0)
	@GeneratedValue
	public Long getTeacherId() {
		return this.teacherId;
	}

	public void setTeacherId(Long teacherId) {
		this.teacherId = teacherId;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "College_id")
	public College getCollege() {
		return this.college;
	}

	public void setCollege(College college) {
		this.college = college;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "Teacher_Title_Type_id")
	public TeacherTitleType getTeacherTitleType() {
		return this.teacherTitleType;
	}

	public void setTeacherTitleType(TeacherTitleType teacherTitleType) {
		this.teacherTitleType = teacherTitleType;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "Teacher_Position_Type_id")
	public TeacherPositionType getTeacherPositionType() {
		return this.teacherPositionType;
	}

	public void setTeacherPositionType(TeacherPositionType teacherPositionType) {
		this.teacherPositionType = teacherPositionType;
	}

	@Column(name = "Teacher_NickName", length = 32)
	public String getTeacherNickName() {
		return this.teacherNickName;
	}

	public void setTeacherNickName(String teacherNickName) {
		this.teacherNickName = teacherNickName;
	}

	@Column(name = "Teacher_Name", nullable = false, length = 32)
	public String getTeacherName() {
		return this.teacherName;
	}

	public void setTeacherName(String teacherName) {
		this.teacherName = teacherName;
	}

	@Column(name = "Password", nullable = false, length = 20)
	public String getPassword() {
		return this.password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	@Column(name = "Phone", length = 20)
	public String getPhone() {
		return this.phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	@Column(name = "Mobile", length = 20)
	public String getMobile() {
		return this.mobile;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}

	@Column(name = "QQ", length = 20)
	public String getQq() {
		return this.qq;
	}

	public void setQq(String qq) {
		this.qq = qq;
	}

	@Column(name = "Email", length = 50)
	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	@Column(name = "LastLoginTime", length = 23)
	public Timestamp getLastLoginTime() {
		return this.lastLoginTime;
	}

	public void setLastLoginTime(Timestamp lastLoginTime) {
		this.lastLoginTime = lastLoginTime;
	}

	@Column(name = "Teacher_Number", length = 50)
	public String getTeacherNumber() {
		return this.teacherNumber;
	}

	public void setTeacherNumber(String teacherNumber) {
		this.teacherNumber = teacherNumber;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "teacher")
	public Set<ClassInfo> getClassInfos() {
		return this.classInfos;
	}

	public void setClassInfos(Set<ClassInfo> classInfos) {
		this.classInfos = classInfos;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "teacher")
	public Set<TeacherAppraisal> getTeacherAppraisals() {
		return this.teacherAppraisals;
	}

	public void setTeacherAppraisals(Set<TeacherAppraisal> teacherAppraisals) {
		this.teacherAppraisals = teacherAppraisals;
	}

}